package com.yidu.BusinessParameters.mapper;

import com.yidu.BusinessParameters.entity.MarketEntity;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

@Repository
public interface MarketMapper {
    @Select("SELECT * FROM market AS m JOIN security AS s ON m.securityId=s.securityId")
    public List<MarketEntity> marketSelect();
    @Select("SELECT * FROM market AS m JOIN security AS s ON m.securityId=s.securityId WHERE 1=1 ${moneyAllocate} order by marketId limit #{page},#{limit} ")
    public List<MarketEntity> marketSelects(Map map);
    @Insert("insert into market values(#{marketId},#{fundId},#{securityId},#{inputDate},#{openMoney},#{endMoney},#{marketBeiZhu})")
    public int marketinsert(MarketEntity marketEntity);
    @Delete("delete from market where marketId=#{marketId}")
    public int marketdelete(String marketId);
    @Update("update market set fundId=#{fundId},securityId=#{securityId},inputDate=#{inputDate},openMoney=#{openMoney},endMoney=#{endMoney},marketBeiZhu=#{marketBeiZhu} where marketId=#{marketId}")
    public int marketupdate(MarketEntity marketEntity);
    @Select("SELECT count(*) FROM market AS m JOIN security AS s ON m.securityId=s.securityId")
    int two();
}
